<?php if(!IS_AJAX){?>
<include file="Public:header" />
<style>
.categorybtn {
	border-radius: 0;
	margin: 0;
	border: none;
}
.categorybtn.on {
	background: #fff;
	color: #47AEC8;
}
.form-widget {
	height: 250px;
	overflow: hidden;
	font-size: 12px;
	margin-top: 5px;
	margin-bottom: 15px;
}
.form-widget>form {
	background-color: #f3f3f3;
	padding: 10px;
	min-height: 100%;
}
.form-widget .form-title, .form-widget>form {
	width: 120%;
	transform: scale(0.8333333333333333);
	transform-origin: left top;
}
.form-widget .cover {
	position: relative;
	width: 100%;
}
.form-widget .cover .row {
	margin: 0;
	width: 100%;
	height: 250px;
	background: linear-gradient(to top, rgba(0,0,0,0.7) 0, rgba(0,0,0,0.05) 40%);
	position: absolute;
	left: 0;
	z-index: 1
}
.form-widget .form-detail {
	color: #fff;
	position: absolute;
	width: 100%;
	bottom: -20px;
	padding: 5px;
	transition: all ease-in-out 0.3s
}
.form-widget .form-detail time {
	color: #fff;
	opacity: 0;
	transition: all ease-in-out 0.2s;
	display: block;
	max-height: 36px;
	overflow: hidden;
	width:100%;
	margin-top:5px;
}
.form-widget .cover .row:hover .form-detail {
	bottom: 0px;
}
.form-widget .cover .row:hover .form-detail time {
	opacity: 1;
}
.form-widget .form-detail .btn {
	background: none;
	color: #fff;
	transition: all ease-in-out 0.2s;
	margin-top:8px;
	margin-left: 4px;
}
.form-widget .form-detail .btn:hover {
	background: #fff;
	color: #999;
}
</style>

<div class="page-title chart-container"> </div>
<div class="row">
  <div class="col-sm-7 col-md-8 col-lg-9">
    <div class="panel">
      <div class="panel-heading"> <span class="pagetitle">领取表格</span> </div>
      <div class="panel-body">
        <div class="row"> 
          <!-- 客户列表 -->
          <div class="" id="ajaxlistbox">
            <?php }?>
            <!-- 数据主体 -->
            
            <?php if(IS_AJAX){?>
            <volist name="list" id="vo">
            <!--添加界面引导 BY zmx-->
              <div class="DataListItem DataListItembg item{$vo.id} col-md-4 col-sm-6 form-widget" id="ajaxlistbox-{$vo.id}" <eq name="key" value="0">data-position="right" data-intro="一个表格对应线下的一张申请表格（例如：请假条、物资申请表、调薪申请表、项目申请书等等），使用电子表格可以简化线下真实表格的打印、填写、收集、整理、录入系统的过程，并且可以永久保存，查询及其方便。在这里你可以增加、删除、修改表格"</eq>>
                <div class="cover">
                  <div class="row">
                    <div class="form-detail optionBtnBox">
                    <!--隐藏表格下面按钮旁边的标题 2016-11-29 by：zmx-->
                      <h5> <!--{$vo.name} -->
                        <!--增加权限控制2016-11-29 by：zmx-->
                        <if condition="getAccessMenu($accessList, 'Intesys', 'Taskform', 'getform')">
                          <button class="btn btn-default btn-xs pull-right" onClick="_openWindow('{:U('getform', array('id' => $vo['id']))}',800, '{$vo.name}', '确定',function(){ $.ThinkBox.success('领取成功！',{'delayClose':200}); },'')" type="button">领取表格</button>
                        </if>
                        <!--增加权限控制2016-11-29 by：zmx-->
                        <if condition="getAccessMenu($accessList, 'Intesys', 'Taskform', 'edit')">
                          <button class="btn btn-default btn-xs pull-right" onClick="_openWindow('{:U('edit', array('id' => $vo['id']))}',650, '修改表格', '确定',function(){ $.ThinkBox.success('修改成功！',{'delayClose':200});  },'')" type="button">修改表格</button>
                        </if>
                        <!--增加权限控制2016-11-29 by：zmx-->
                        <if condition="getAccessMenu($accessList, 'Intesys', 'Taskform', 'modify')">
                          <button class="btn btn-default btn-xs pull-right" onClick="_openWindow('{:U('modify', array('id' => $vo['id']))}',650, '{$vo.name}', '确定',function(){  $.ThinkBox.success('修改成功！',{'delayClose':200}); },'')" type="button">修改内容</button>
                        </if>
                        <!--增加权限控制2016-11-29 by：zmx-->
                        <if condition="getAccessMenu($accessList, 'Intesys', 'Taskform', 'delete')">
                          <a class="btn btn-default btn-xs pull-right btn-delete" data-id="{$vo['id']}" href="javascript:void(0);" rel="{:U('delete', array('id' => $vo['id']))}" title="删除规则"> 删除表格 </a>
                        </if>
                      </h5>
                      <time>{:!empty($vo['remark'])?$vo['remark']:'表格无描述'}</time>
                    </div>
                  </div>
                </div>
                <div class="aui_titleBar form-title" style="bottom:0px; height:37.5px;">
                  <div class="aui_title" style="cursor: move; display: block;background: #65cea7;"> {$vo.name} </div>
                 </div>
                {$vo.formtemplate} </div>
                
              <!-- 数据主体结束 --> 
            </volist>
            <?php }?>
          </div>
          </if>
          <?php if(!IS_AJAX){?>
        </div>
      <div class="PagesBox text-center" id="ajaxlistboxpages"> </div>
      <!-- 客户列表结束 -->
    </div>
    </div>
  </div>
  <div class="col-sm-5 col-md-4 col-lg-3">
    <div class="affixelement">
      <div class="states-info">
        <div class="panel green-bg" id="" style="cursor:pointer" onClick="_openWindow('<?php echo U('add') ?>',650,'新建积分规则','提交',function(){ $.ThinkBox.success('操作成功！',{'delayClose':200});  });">
          <div class="panel-body">
            <div class="row">
              <div class="col-xs-3"> <i class="fa icon-table"></i> </div>
              <div class="col-xs-7">
                <h4>新建表格</h4>
                <span class="state-title">为公司建立新的表格 </span> </div>
              <div class="col-xs-2"> <span class="fa icon-angle-right"></span> </div>
            </div>
          </div>
        </div>
      </div>
    <div class="panel">
      <header class="panel-heading"> 表格分类 <span class="pull-right">

        <!--增加权限控制2016-11-29 by：zmx-->
        <if condition="getAccessMenu($accessList, 'Intesys', 'Formcategory', 'add')"> 
        	<a href="javascript:void(0);" id="infocategoryboxaddbtn" onClick="_openWindow('<?php echo U('Formcategory/add');?>',650, '增加分类', '确定',function(){ $('#nestable_list_3form').submit(); },'')" width="300" title="表格"> 增加分类 </a>
        </if>
        </span> </header>
      <!--<div class="panel-body">-->
      <!--<html:dropdownselect class="memberselect" selected="" name="member" style="height:auto; width:auto;" multi="0" action="{:U('Formcategory/index')}" title="选择员工" />-->
        <!--</div>-->
      <!--增加权限控制2016-11-29 by：zmx-->
      <if condition="getAccessMenu($accessList, 'Intesys', 'Taskform', 'index')">
        <form action="{:U('Taskform/index')}" id="ajaxlistboxform">
          <input type="hidden"  name="keywords" value="">
        </form>
        <div class="panel-body">
          <html:dropdownselect class="typeselect" selected="" name="type" style="height:auto; width:auto;" multi="0" action="{:U('Team/form')}" title="选择表格分类"  placeholder="点击选择表格分类"  listloaded="listloaded" />
          <style>
            .selectlist{margin:0; padding:0;}
            .selectlist ul{padding:0}
            .selectlist li{list-style-type:none; margin:0; padding:0;padding:5px; border-bottom:1px solid #eee; margin:0 8px;}
            .selectlist li:hover{background:#eee;}
          </style>
          <div id="reselectlayout" style="top:0; display:none; left:0; bottom:0; right:0; position:fixed; z-index:4999;">
          </div>
        </div>
        <!--<div class="panel-body">-->
          <!--&lt;!&ndash; 表格分类 &ndash;&gt;-->
          <!--<table width="100%" border="0" cellspacing="0" cellpadding="0">-->
            <!--<tbody id="infocategorybox">-->
            <!--</tbody>-->
          <!--</table>-->
          <!--<div id="infocategoryboxpages"> </div>-->
          <!--<form id="ajaxlistboxform" action="<?php echo U('');?>">-->
          <!--</form>-->
          <!--<form action="<?php echo U('Formcategory/index');?>" id="infocategoryboxform">-->
          <!--</form>-->
          <!--&lt;!&ndash; &ndash;&gt;-->
          <!--<section class="panel">-->
            <!--<div class="panel-body dd" id="nestable_list_3"> </div>-->
          <!--</section>-->
          <!--<div class="pages" id="nestable_list_3pages"></div>-->
          <!--<form id="nestable_list_3form" action="<?php echo U('Formcategory/tree');?>">-->
          <!--</form>-->
        <!--</div>-->
      </if>


    </div>
    </div>
  </div>
</div>
<include file="Public:script" /> 
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Js/ueditor/ueditor.config.js"></script> 
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Js/ueditor/ueditor.all.min.js"> </script> 
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Js/ueditor/lang/zh-cn/zh-cn.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/zTree_v3/css/zTreeStyle/zTreeStyle.css">
<script type="text/javascript" src="/Public/Js/zTree_v3/js/jquery.ztree.core-3.5.js"></script>
<link rel="stylesheet" type="text/css" href="/Public/Intesys/AdminX/js/nestable/jquery.nestable.css"/>
<script src="/Public/Intesys/AdminX/js/nestable/jquery.nestable.js"></script> 
<script>
/*$('#infocategorybox').ajaxlist({nodata:'<div style="text-align:center;">暂无分类</div>', success:function(obj){
	obj.find('.titletext').each(function(index, element){
		$(this).removeClass('titletext');
		$(this).click(function(e) {
            var html = '<div id="member_pos_id'+$(this).attr('data-id')+'" class="alert alert-info" style="display:inline-block; margin-bottom:2px; margin-right:2px; padding:5px;"><button type="button" class="close close-sm" onclick="" data-dismiss="alert"> <i class="fa icon-times"></i> </button><strong><input type="hidden" value="'+$(this).attr('data-id')+'" name="id[]" class="NodeId" />'+$(this).html()+'</strong> </div>';
          $('#member_pos_id'+$(this).attr('data-id')).remove();
          $(html).appendTo('#ajaxlistboxform').find('.close').each(function(){
              $(this).click(function(e) {
                  setTimeout(function(){ $('#ajaxlistboxform').submit()}, 200);
              });
          });
          $('#ajaxlistboxform').submit();
        });
	});
}});*/
    $('#ajaxlistbox').ajaxlist({success:function(){
		$(".btn-delete").click(function(e) {
            if(confirm('是否真的要删除')){
				$.getJSON($(this).attr('rel'),{ },function(){
					$("#ajaxlistboxform").submit();	
				});
			}
        });	
	}});

//表格分类列表
$('#nestable_list_3').ajaxlist({success:function(){
	if($('#nestable_list_3 li').length == 0){
		$('#nestable_list_3').html('<div style="padding:10px; text-align:center;">暂无分类</div>');
	}
	Nestable1();
}});

///////////改改改201612211203//////////////////////////
function listloaded(){
  $('.typeselect').blur(function(){
    $("#ajaxlistboxform input[name='keywords']").remove();
    if($('.typeselect .itemspan').children("input:eq(1)").length!=0){
      $('#ajaxlistboxform').append("<input type='hidden' name='keywords' value='"+$('.typeselect .itemspan').children("input:eq(1)").attr('value')+"'>");
    }
    $('#ajaxlistboxform').submit();
  });
}


function  Nestable1() {
    var updateOutput = function (e) {
        var list = e.length ? e : $(e.target),
            output = list.data('output');
        if (window.JSON) {
			//alert(window.JSON.stringify(list.nestable('serialize')));
			$.post('<?php echo U('updatesort');?>',{data:window.JSON.stringify(list.nestable('serialize'))}, function(data){
				
			},'json');
           // output.val(window.JSON.stringify(list.nestable('serialize'))); //, null, 2));
        } else {
            output.val('JSON browser support required for this demo.');
        }
    };
    // activate Nestable for list 2
    $('#nestable_list_3').nestable()
        .on('change', updateOutput);
    // output initial serialised data
    //updateOutput($('#nestable_list_1').data('output', $('#nestable_list_1_output')));
    //updateOutput($('#nestable_list_2').data('output', $('#nestable_list_2_output')));
};
</script>
<style>
    #infocategorybox td{padding:5px;}
</style>
</body></html><?php }?>
